package com.android.rapidcash.fragments

import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import com.android.lib.base.baseclass.BaseVMFragment
import com.android.lib.base.ext.*
import com.android.lib.base.glide.setUrl
import com.android.lib.base.glide.setUrlRound
import com.android.lib.base.manager.LiveBusManager
import com.android.lib.base.manager.MMKVManager
import com.android.rapidcash.activitys.CustomerServiceActivity
import com.android.rapidcash.activitys.LanguageChangeActivity
import com.android.rapidcash.activitys.LoginActivity
import com.android.rapidcash.activitys.WebActivity
import com.android.rapidcash.adapters.BannerImgAdapter
import com.android.rapidcash.dialog.MoreDialog
import com.android.rapidcash.utils.CommUtils
import com.android.rapidcash.viewmodel.MainViewModel
import com.rapidcash.abanca.santander.vivus.revolut.waylet.libertex.icmarkets.caixabank.databinding.FragmentMeBinding
import com.youth.banner.indicator.CircleIndicator


class MeFragment : BaseVMFragment<MainViewModel, FragmentMeBinding>() {

    @SuppressLint("SetTextI18n")
    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)
        mBinding.ivBack.chip(35)
    }

    private fun refresh() {
        if (!MMKVManager.decodeString("phone").isEmpty()) {
            mBinding.tv5.visible()
            mBinding.tv5.text = "+34 ${MMKVManager.decodeString("phone")}"
        } else {
            mBinding.tv5.gone()
        }

    }

    override fun lazyLoadData() {
        refresh()
    }

    override fun initListener() {
        mBinding.tv1.click {
            startActivity(Intent(requireContext(), LanguageChangeActivity::class.java))
        }
        mBinding.tv2.click {
            startActivity(Intent(requireContext(), WebActivity::class.java).apply {
                putExtra("url", "https://www.baidu.com")
                putExtra("title", "Avisos de Privacidad")
            })

        }
        mBinding.tv3.click {
            startActivity(Intent(requireContext(), CustomerServiceActivity::class.java))
        }
        mBinding.tv4.click {

        }

    }

    override fun initObserve() {

    }


    companion object {
        @JvmStatic
        fun newInstance() = MeFragment()
    }
}